<template>
  <el-icon v-if="getType === 1">
    <component :is="ElementPlusIcons[icon]"></component>
  </el-icon>
  <i class="el-icon" :class="`iconfont ${icon}`" v-else-if="getType === 2">
  </i>
</template>
<script setup>
import * as ElementPlusIcons from "@element-plus/icons-vue";
import { computed } from "vue";
const props = defineProps({
  icon: {
    type: String,
    default: "",
  },
});
const getType = computed(() => {
  if (!props.icon) return 0;
  if (props.icon.indexOf("icon-") !== -1) return 2;
  return 1;
});
</script>